<script language="javascript">
	
 function wopen(url, name, w, h){
	  w += 32;
	  h += 96;
	  wleft = (screen.width - w) / 2;
	  wtop = (screen.height - h) / 2;
	  
	  if (wleft < 0) {
		w = screen.width;
		wleft = 0;
	  }
	  if (wtop < 0) {
		h = screen.height;
		wtop = 0;
	  }
	  var win = window.open(url,
		name,
		'width=' + w + ', height=' + h + ', ' +
		'left=' + wleft + ', top=' + wtop + ', ' +
		'location=no, menubar=no, ' +
		'status=no, toolbar=no, scrollbars=yes, resizable=no');
	  // Just in case width and height are ignored
	  win.resizeTo(w, h);
	  // Just in case left and top are ignored
	  win.moveTo(wleft, wtop);
	  win.focus();
}
function printTL(namhoc,hocki,maso){
	
	wopen('Hienthikhoiluonggiangday.php?namhoc='+namhoc+'&hocki='+hocki+'&maso='+maso+'','780','580');
}  
</script>
<?php
     
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        
        if (isset($_POST['btnxem'])){
            $nam = $_POST['cbonam'];
            $namhoc = $_POST['cbonamhoc'];
            $hocki = $_POST['cbohocki'];
            $maquyen = $_SESSION['nmaquyen'];
            $maso = " ";
            if ($maquyen == 'GV'){
                $maso = $_SESSION['nmaso'];
            }
            else if ($maquyen == 'AD'){
                $maso = $_POST['txtmaso'];
            }
            else{
                $maso = $_POST['cbomaso'];
            }
            $db->setQuery("select concat(holot, ' ', ten) as hoten from CanBo where maso='".$maso."'");
            $result = $db->fetchAll();
            $rows = mysql_fetch_array($result);
            $hoten = $rows['hoten'];
            /*echo "<script language=\"javascript\">";
                
           //echo "alert('Hello')";
            echo "printTL('$namhoc','$hocki','$maso');";
          
            echo "</script>";*/
            /*$query1 = "select distinct thu,a.mahp,kihieu,tenhp,a.malophp,siso,tietbd, sotiet, maso, maphong,a.tuanhoc ";
            $query1 .= "from LopHocPhan a, ThoiKhoaBieu b, HocPhan c ";
            $query1 .= "where maso='".$maso."' and hocki=".$hocki." and namhoc='".$namhoc."' ";
            $query1 .= "and a.malophp = b.malophp and a.mahp = c.mahp ";
            $query1 .= "order by thu ";
            $tkb->setQuery($query1);
            $result1 = $tkb->fetchAll();
            $query2 = "select distinct a.malophp,kihieu,a.mahp,tenhp,siso,a.tuanhoc ";
            $query2 .= "from LopHocPhan a, HocPhan b ";
            $query2 .= "where maso='".$maso."' and hocki=".$hocki." and namhoc='".$namhoc."'  and (manhom =5 or manhom =6) ";
            $query2 .= "and a.mahp = b.mahp ";
            $query2 .= "order by a.mahp ";
            $tkb->setQuery($query2);
            //echo $tkb->getQuery();
            $result2 = $tkb->fetchAll();*/
            require('Views/Xemkhoiluonggiangday.php');
        }
        
        
    }
    else{
        if ($_GET['option']=='xemkhoiluonggd'){
            require('Views/Xemkhoiluonggiangday.php');
        }
        
    }
  
                                
  
?>
